﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true"
    CodeBehind="MyOrder.aspx.cs" Inherits="MLM.AdminCP.Pages.MyOrder" Culture="auto"
    meta:resourcekey="PageResource1" UICulture="auto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label runat="server" ID="lbmyorder" Text="My Orders"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <telerik:RadGrid ID="ProductOrderGrid" runat="server" AllowFilteringByColumn="True"
        DataSourceID="ProductOrderEds" AllowPaging="True" AllowSorting="True" GridLines="None"
        ShowGroupPanel="True"  AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        AllowAutomaticDeletes="True" ShowFooter="True" ShowStatusBar="True" meta:resourcekey="ProductOrderGridResource1">
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            <Selecting AllowRowSelect="True"></Selecting>
            <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="InvoiceID" DataSourceID="ProductOrderEds"
            ShowHeadersWhenNoRecords="true">
            <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true"></CommandItemSettings>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="InvoiceID" HeaderText="InvoiceID" ReadOnly="True"
                    SortExpression="InvoiceID" UniqueName="InvoiceID" meta:resourcekey="GridBoundColumnResource1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" ReadOnly="True"
                    SortExpression="UserID" UniqueName="UserID" meta:resourcekey="GridBoundColumnResource2">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DepoID" HeaderText="Order to" ReadOnly="True"
                    SortExpression="DepoID" UniqueName="DepoID" meta:resourcekey="GridBoundColumnResource3">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DateTimeCreated" HeaderText="DateTime Created"
                    ReadOnly="True" SortExpression="DateTimeCreated" UniqueName="DateTimeCreated"
                    meta:resourcekey="GridBoundColumnResource4">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn runat="server" AllowFiltering="true" DataField="Status"
                    HeaderText="Status" meta:resourcekey="GridTemplateColumnResource1">
                    <ItemTemplate>
                        <%# long.Parse(Eval("Status").ToString())==-1?"<span style='color:orange;'>Pending</span>":(long.Parse(Eval("Status").ToString())==1?"<span style='color:green;'>Complete</span>":"<span style='color:red'>Cancelled</span>") %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn runat="server" ShowFilterIcon="false" AllowFiltering="false"
                    meta:resourcekey="GridTemplateColumnResource2">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                    <ItemTemplate>
                         <a href='/AdminCP/Pages/BillExport.aspx?ID=<%# Eval("InvoiceID") %>'>Bill</a> 
                        <a href='/AdminCP/Pages/MyOrderDetail.aspx?ID=<%# Eval("InvoiceID") %>'>
                            <asp:Label runat="server" ID="lbView" Text="View" 
                            meta:resourcekey="lbViewResource1"></asp:Label></a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007">
        </HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="ProductOrderEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableUpdate="True"
        EntitySetName="Invoices" AutoGenerateWhereClause="True" 
        EntityTypeFilter="" Select="" OrderBy="it.InvoiceID desc">
        <WhereParameters>
            <%--<asp:SessionParameter runat="server" Name="UserID" SessionField="CurrentUserId" Type="Int64" />--%>
            <asp:CookieParameter runat="server" Name="UserID" CookieName="CurrentUserId" Type="Int64" />
        </WhereParameters>
    </asp:EntityDataSource>
    <asp:Panel runat="server" ID="PanelIncomming">
          <h3>Incoming Order</h3>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
        DataSourceID="ProductOrderToMeEds" AllowPaging="True" AllowSorting="True" GridLines="None"
        ShowGroupPanel="True"  AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        AllowAutomaticDeletes="True" ShowFooter="True" ShowStatusBar="True" meta:resourcekey="ProductOrderGridResource1">
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            <Selecting AllowRowSelect="True"></Selecting>
            <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="InvoiceID" DataSourceID="ProductOrderToMeEds"
            ShowHeadersWhenNoRecords="true">
            <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true"></CommandItemSettings>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="InvoiceID" HeaderText="InvoiceID" ReadOnly="True"
                    SortExpression="InvoiceID" UniqueName="InvoiceID" meta:resourcekey="GridBoundColumnResource1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" ReadOnly="True"
                    SortExpression="UserID" UniqueName="UserID" meta:resourcekey="GridBoundColumnResource2">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DepoID" HeaderText="Order to" ReadOnly="True"
                    SortExpression="DepoID" UniqueName="DepoID" meta:resourcekey="GridBoundColumnResource3">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DateTimeCreated" HeaderText="DateTime Created"
                    ReadOnly="True" SortExpression="DateTimeCreated" UniqueName="DateTimeCreated"
                    meta:resourcekey="GridBoundColumnResource4">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn runat="server" AllowFiltering="true" DataField="Status"
                    HeaderText="Status" meta:resourcekey="GridTemplateColumnResource1">
                    <ItemTemplate>
                        <%# long.Parse(Eval("Status").ToString())==-1?"<span style='color:orange;'>Pending</span>":(long.Parse(Eval("Status").ToString())==1?"<span style='color:green;'>Complete</span>":"<span style='color:red'>Cancelled</span>") %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn runat="server" ShowFilterIcon="false" AllowFiltering="false"
                    meta:resourcekey="GridTemplateColumnResource2">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                    <ItemTemplate>
                         <a href='/AdminCP/Pages/BillExport.aspx?ID=<%# Eval("InvoiceID") %>'>Bill</a> 
                        <a href='/AdminCP/Pages/IncommingOrderDetail.aspx?ID=<%# Eval("InvoiceID") %>'>
                            <asp:Label runat="server" ID="lbView" Text="View" 
                            meta:resourcekey="lbViewResource1"></asp:Label></a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007">
        </HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="ProductOrderToMeEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableUpdate="True"
        EntitySetName="Invoices" AutoGenerateWhereClause="True" OrderBy="it.InvoiceID desc"
        EntityTypeFilter="" Select="">
        <WhereParameters>
            <%--<asp:SessionParameter runat="server" Name="UserID" SessionField="CurrentUserId" Type="Int64" />--%>
            <asp:CookieParameter runat="server" Name="DepoID" CookieName="CurrentUserId" Type="Int64" />
        </WhereParameters>
    </asp:EntityDataSource>
    </asp:Panel>  
</asp:Content>
